package com.ruoyi.basedocument.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.basedocument.domain.BomFileattstor;
import com.ruoyi.basedocument.service.IBomFileattstorService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 文件存储Controller
 * 
 * @author ruoyi
 * @date 2024-11-18
 */
@RestController
@RequestMapping("/bomcostestimation/basedocument/fileattstor")
public class BomFileattstorController extends BaseController
{
    @Autowired
    private IBomFileattstorService bomFileattstorService;

    /**
     * 查询文件存储列表
     */
    @PreAuthorize("@ss.hasPermi('bomcostestimation/basedocument:fileattstor:list')")
    @GetMapping("/list")
    public TableDataInfo list(BomFileattstor bomFileattstor)
    {
        startPage();
        List<BomFileattstor> list = bomFileattstorService.selectBomFileattstorList(bomFileattstor);
        return getDataTable(list);
    }

    /**
     * 导出文件存储列表
     */
    @PreAuthorize("@ss.hasPermi('bomcostestimation/basedocument:fileattstor:export')")
    @Log(title = "文件存储", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BomFileattstor bomFileattstor)
    {
        List<BomFileattstor> list = bomFileattstorService.selectBomFileattstorList(bomFileattstor);
        ExcelUtil<BomFileattstor> util = new ExcelUtil<BomFileattstor>(BomFileattstor.class);
        util.exportExcel(response, list, "文件存储数据");
    }

    /**
     * 获取文件存储详细信息
     */
    @PreAuthorize("@ss.hasPermi('bomcostestimation/basedocument:fileattstor:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(bomFileattstorService.selectBomFileattstorById(id));
    }

    /**
     * 新增文件存储
     */
    @PreAuthorize("@ss.hasPermi('bomcostestimation/basedocument:fileattstor:add')")
    @Log(title = "文件存储", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BomFileattstor bomFileattstor)
    {
        return toAjax(bomFileattstorService.insertBomFileattstor(bomFileattstor));
    }

    /**
     * 修改文件存储
     */
    @PreAuthorize("@ss.hasPermi('bomcostestimation/basedocument:fileattstor:edit')")
    @Log(title = "文件存储", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BomFileattstor bomFileattstor)
    {
        return toAjax(bomFileattstorService.updateBomFileattstor(bomFileattstor));
    }

    /**
     * 删除文件存储
     */
    @PreAuthorize("@ss.hasPermi('bomcostestimation/basedocument:fileattstor:remove')")
    @Log(title = "文件存储", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(bomFileattstorService.deleteBomFileattstorByIds(ids));
    }
}
